package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.entity.Result;
import com.itheima.pojo.Permission;
import com.itheima.service.PermissionService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: Dream_die
 * @Date: 2020/4/17 20:20
 */
@RestController
@RequestMapping("/permission")
public class PermissionController {

    @Reference
    private PermissionService permissionService;

    @RequestMapping("/findAll")
    public Result findAll(){
        try {
            List<Permission> roles = permissionService.findAll();
            return new Result(true, "查询权限信息成功",roles);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false,"查询权限信息失败！","网络繁忙，请稍后再试！");
        }
    }


}
